package com.lengxf.aPlugins.entity;

import com.lengxf.aPlugins.bizType.BizEnums;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;


@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Schema(description = "EVENT_POINT_BUSINESS_TYPE")
public class EventPointBusinessTypeEntity implements SqlGenerator{

    @Schema(description = "ID")
    private Long id;

    /**
     * NAME
     */
    @Schema(description = "NAME")
    private String name;

    /**
     * CODE
     */
    @Schema(description = "CODE")
    private String code;

    /**
     * CREATION_TIME
     */
    @Schema(description = "CREATION_TIME")
    private LocalDateTime creationTime;

    /**
     * CREATION_USER
     */
    @Schema(description = "CREATION_USER")
    private String creationUser;

    /**
     * LAST_MODIFIED_TIME
     */
    @Schema(description = "LAST_MODIFIED_TIME")
    private LocalDateTime lastModifiedTime;

    /**
     * LAST_MODIFIED_USER
     */
    @Schema(description = "LAST_MODIFIED_USER")
    private String lastModifiedUser;

    /**
     * TYPE
     */
    @Schema(description = "TYPE")
    private String type;

    /**
     * AREA
     */
    @Schema(description = "AREA")
    private String area;

    public EventPointBusinessTypeEntity(String area, BizEnums bizEnums) {
        this.area = bizEnums.getBizAreaTag();
        this.type = bizEnums.getListenerName();
        this.name = area + bizEnums.getBizName();
        this.creationTime = LocalDateTime.now();
        this.lastModifiedTime = LocalDateTime.now();
        this.creationUser = "admin";
        this.lastModifiedUser = "admin";
    }

}
